//
//  FirstPageTableViewCell.m
//  Consume100
//
//  Created by eliot on 16/3/22.
//  Copyright © 2016年 aleven. All rights reserved.
//

#import "FirstPageTableViewCell.h"
#import "UIImageView+WebCache.h"
@implementation FirstPageTableViewCell

- (void) setUpCellWithArr:(NSArray *)arr {
    
    self.btn1 = [UIButton buttonWithType:UIButtonTypeCustom];
    self.btn1.frame = CGRectMake(self.firstIV.frame.origin.x
, self.firstIV.frame.origin.y, self.firstIV.frame.size.width, self.firstIV.frame.size.height + 30);
    
    self.btn2 = [UIButton buttonWithType:UIButtonTypeCustom];
    self.btn2.frame = CGRectMake(self.secondIV.frame.origin.x
                                 , self.secondIV.frame.origin.y, self.secondIV.frame.size.width, self.secondIV.frame.size.height + 30);
    
    self.btn3 = [UIButton buttonWithType:UIButtonTypeCustom];
    self.btn3.frame = CGRectMake(self.thridIV.frame.origin.x
                                 , self.thridIV.frame.origin.y, self.thridIV.frame.size.width, self.thridIV.frame.size.height + 30);
    
    self.btn1.tag = 1;
    self.btn2.tag = 2;
    self.btn3.tag = 3;
    
    [self addSubview:self.btn1];
    [self addSubview:self.btn2];
    [self addSubview:self.btn3];
    
    [self.firstIV sd_setImageWithURL:[NSURL URLWithString:@""]];
    self.firstLb.text = @"";
    self.btn1.userInteractionEnabled = NO;
    self.btn2.userInteractionEnabled = NO;
    self.btn3.userInteractionEnabled = NO;
    
    [self.secondIV sd_setImageWithURL:[NSURL URLWithString:@""]];
    self.secondLb.text = @"";
    
    [self.thridIV sd_setImageWithURL:[NSURL URLWithString:@""]];
    self.thridLb.text = @"";
    

    
    for (int i = 0; i < arr.count; i++) {
        NSDictionary *tepDic = arr[i];
        if (i == 0) {
            [self.firstIV sd_setImageWithURL:[NSURL URLWithString:tepDic[@"businessImg"]]];
            self.firstLb.text = tepDic[@"businessName"];
            self.btn1.userInteractionEnabled = YES;
        }
        if (i == 1) {
            [self.secondIV sd_setImageWithURL:[NSURL URLWithString:tepDic[@"businessImg"]]];
            self.secondLb.text = tepDic[@"businessName"];
            self.btn2.userInteractionEnabled = YES;
        }
        if (i == 2) {
            [self.thridIV sd_setImageWithURL:[NSURL URLWithString:tepDic[@"businessImg"]]];
            self.thridLb.text = tepDic[@"businessName"];
            self.btn3.userInteractionEnabled = YES;
        }
        
    }
}





- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
